static var cam : int;
var view : changeView;
private var object : GameObject;
var objectArray2D : GameObject[];
var objectArray3D : GameObject[];
	
function Awake()
{	
	// Get a list of all the objects in the scene that have been tagged as "2DObjects"
	objectArray2D = GameObject.FindGameObjectsWithTag("2DObjects");
	
	// Get a list of all the objects in the scene that have been tagged as "3DObjects"
	objectArray3D = GameObject.FindGameObjectsWithTag("3DObjects");
}	

function Start()
{
	// set the variable view to the changeView script found on the Player GameObject
	view = GameObject.Find("pCharacter").GetComponent(changeView);
	
	// set cam to that of the startCamera in the changeView Script
	cam = view.startCamera;
}

function FixedUpdate()
{
	// Check which camera is active
	cam = view.startCamera;
	
	// For every GameObject that has been tagged as "2DObjects" and is stored in the objectArray2D
	for(object in objectArray2D)
	{
		// If 2D camera is enabled and the 2D objects aren't visible
		if(cam == 1 && object.renderer.enabled.Equals(false))
			// Make them visible (Render them)
			object.renderer.enabled = true;
		
		// If 3D camera is enabled and the 2D objects are visible
		if((cam == 2 || cam == 3) && object.renderer.enabled.Equals(true))
			// Make them invisible (Disable the Mesh Renderer)
			object.renderer.enabled = false;
	}
	
	// For every gameobject that has been tagged as "3DObjects"
	for(object in objectArray3D)
	{
		// If 2D Camera is enabled and the 3D objects are visible
		if(cam == 1 && object.renderer.enabled.Equals(true))
			// Make them visible (Render them)
			object.renderer.enabled = false;

		// If 3D Camera is enabled and the 3D objects are not visible
		if((cam == 2 || cam == 3) && object.renderer.enabled.Equals(false))
			// Make them visible (Render them)
			object.renderer.enabled = true;
	}
	
}